package com.zam.comment;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Author talent_dog
 * @Date 2023/12/14 15:04
 * @Version 1.0
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result {
    private String code;
    private String msg;
    private Object data;

    //没有数据，成功时
    public static Result success(){
        return new Result(Constants.CODE_200,"",null);
    }

    //有数据，成功时
    public static Result success(Object data){
        return new Result(Constants.CODE_200,"",data);
    }

    //失败 ，有状态码
    public static Result error(String code,String msg){
        return new Result(code,msg,null);
    }

    //失败，默认一个
    public static Result error(){
        return new Result(Constants.CODE_500,"系统错误",null);
    }

}